<?php
	/**
	* @package ParkFind
	* @desc This is the report page. This is where the user can submit a report for broken or vandalized equipment/facilities.
	*/
	session_start();

	// Must be logged in
	if (!isset($_SESSION["user_id"]))	
		header("Location: login.php");

	//Smarty
	require 'includes/smarty.inc';
	$smarty->assign('title', "Report");
	$smarty->assign('user_id', $_SESSION["user_id"]);	
	$smarty->assign('last', $_SESSION["lastviewed"]);	
	$smarty->assign('firstname', $_SESSION["firstname"]);
	$smarty->assign('role', $_SESSION["role"]);
	$smarty->assign('top5', $_SESSION["top5"]);	
	$smarty->display('header.tpl');
	

	if (isset($_SESSION["errors"]["type"]))
		$smarty->assign('typeerr', $_SESSION["errors"]["type"]);

	if (isset($_SESSION["form"]["topic"]))
		$smarty->assign('topic', $_SESSION["form"]["topic"]);

	if (isset($_SESSION["errors"]["topic"]))
		$smarty->assign('topicerr', $_SESSION["errors"]["topic"]);
				
	if (isset($_SESSION["form"]["details"]))
		$smarty->assign('details', $_SESSION["form"]["details"]);

	if (isset($_SESSION["errors"]["details"]))
		$smarty->assign('detailserr', $_SESSION["errors"]["details"]);
	
	$smarty->assign('id', $_GET["id"]);
	$smarty->display('report.tpl');
	
	unset($_SESSION["errors"]);
	unset($_SESSION["form"]);
	$smarty->display('footer.tpl'); 
?>
